//
//  UIBarButtonItem+UIButton.swift
//  weibo
//
//  Created by uncle-R on 15/12/20.
//  Copyright © 2015年 uncle-R. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    ///自定义一个构造函数
    convenience init(imageName: String){
        
        let hightName = imageName+"_highlighted"
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        btn.setImage(UIImage(named: hightName), forState: UIControlState.Highlighted)
        btn.sizeToFit()
        //需要调用本类的制定构造函数.
        self.init(customView:btn)
    }
    
    
}